package com.dualPointer;

public class RemoveElement0202_27 {
    public int removeElement(int[] nums, int val) {
        int right = 0;
        int count = 0;

        while (right<nums.length){
            if(nums[right] == val){
                count++;
            }else {
                nums[right-count] = nums[right];
            }
            right++;
        }
        return nums.length - count;
    }
}
